package easy;

/**
 * @author admin
 * 1791. 找出星型图的中心节点
 * 解题思路：只需比较前两个元素，找出公共节点即可
 */
public class LeeCode1791 {

    public int findCenter(int[][] edges) {
        if (edges[0][0] == edges[1][0] || edges[0][0] == edges[1][1]){
            return edges[0][0];
        }else {
            return edges[0][1];
        }
    }

    public static void main(String[] args) {

        int [][] num = {{1,2},{5,1},{1,3},{1,4}};
        System.out.println(new LeeCode1791().findCenter(num));
    }
}
